package com.zuoye;


/*请定义一个描述矩形（MyRectangle）的类，
包含宽和高两个属性，
提供获取矩形周长（perimeter）和面积（area）的方法。
并编写测试类进行测试*/
public class MyRectangle {
    private  int length ;
    private  int  wide;
public MyRectangle(){

}
    public MyRectangle(int length, int  wide) {
        this.length = length;
        this.wide = wide;

    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWide() {
        return wide;
    }

    public void setWide(int wide) {
        this.wide = wide;
    }
    public  void perimeter(){
        System.out.println("周长:" + (length + wide) * 2);
    }
    public  void area(){
        System.out.println("面积:" + length * wide);
    }

}
class TestMyRectangle{
    public static void main(String[] args) {
        MyRectangle l = new MyRectangle();
        l.setLength(20);
        l.setWide(10);
        l.perimeter();
        l.area();
    }
}